import axios from 'axios';


const isTest = false;//是否测试环境。true测试，false正式

// 接口Url.前测后正
const mainUrl = isTest ? "http://120.24.164.93:9096" : "http://120.24.164.93:9094";    //周报系统
// const mainUrl = isTest ? "http://192.168.1.113:9090" : "http://120.24.164.93:9094";    //周报系统(本机)
// const mainUrl = isTest ? "http://192.168.1.164:9090" : "http://192.168.1.103:9090";    //周报系统(本机)
const secUrl = isTest ? "http://120.24.164.93:9094" : "http://120.24.164.93:9094";    //预留
const thirUrl = isTest ? "http://120.24.164.93:9091" : "http://120.24.164.93:9091";    //预留


const fileUrl = 'http://120.24.164.93:8890/archives/'; //文件url(预览)
const fileUpUrl = 'http://120.24.164.93:9092/V1/common/upload';//文件上传Url,(目前为测试)
const headUrl = 'http://112.74.94.53:8080/team/';     //本机构人员的头像地址前缀




export const HTUrl = {
    fileUrl: fileUrl,
    headUrl: headUrl,
    UpUrl: fileUpUrl
};


const HTAjax = {
    //urlType为1时，调用日常调度接口，2时调用投诉办理接口。3时调用新版投诉办理接口
    Post: function (urlType, url, data, _type) {
        var ajaxurl = url.indexOf('http://') > -1 ? url : urlType == 1 ? mainUrl + url : urlType == 2 ? secUrl + url : thirUrl + url;
        _type == "post" ? _type = "post" : _type = "get";       //一般取数用get ,存数有post

        return axios({
            method: _type,
            url: ajaxurl,
            params: data
        })
        // .then(function(response) {
        //    return response.data
        // })
        // .catch(function (error) {
        //    //callback(error.data)
        //});
    },

    //文件上传方法
    UpLoad: function (callback) {

    },

}

export default HTAjax;